<?php
    include('./library/connsql.php');

    $phone = $_REQUEST['phone'];

    $sql = "select * from users where phone = $phone ";

    $temp = $mysqli->query($sql);

    if($temp->num_rows>0){
        echo '0';
        $mysqli->close();
        die();
    }

    $add = "insert into users (username,password,email,phone,sex,address) values('null','null','null','$phone',1,'null')";

    $result = $mysqli->query($add);
    
    $mysqli->close();

    if($result){
        echo '1';
    }
?>